import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments } from 'class-validator';

/**
 *   用于校验密码和确认密码是否一直
 */

@ValidatorConstraint()
export class isConfirmRule implements ValidatorConstraintInterface {

  validate(value: string, args: ValidationArguments) {
    return Boolean(value == args.object[`${args.property}_confirm`])
    
  }
 // 如果错误，默认返回这个
  defaultMessage(validationArguments?: ValidationArguments): string {
      return '比对失败'
  }
}